import React, {useEffect} from 'react';
import Alert from "@material-ui/lab/Alert";
import {makeStyles} from "@material-ui/core";
import {useAuth} from "../contexts/AuthContext";
import {useHistory} from "react-router-dom";

const useStyles = makeStyles(theme => ({
    root: {
        maxWidth: "1100px",
        margin: "auto",
        marginTop: theme.spacing(5)
    }
}))

const ResendActivationDone = () => {
    const classes = useStyles()
    const history = useHistory()
    const {isAuthenticated} = useAuth()

    // 如果已经登录不让她访问这个页面
    useEffect(() => {
        if (isAuthenticated)
            history.push('/')
    }, [isAuthenticated, history])

    return (
        <Alert severity="success" className={classes.root}>
            账号激活链接已经发送到你的邮箱，请查看邮件按照指示激活您的账号
        </Alert>
    );
};

export default ResendActivationDone;